% function [MatDiag, DiagExact] = testRho
if(1)
  N = 64;

  h = (1/N);
  V = 1 + rand(N,N);

  global Tree;
  global mvcount
  disp('Factorization');
  Tree = five_setup(V,N,h);
  disp('Extraction');
  DiagExact = five_extract(N,Tree);
  DiagExact = reshape(DiagExact, N*N, 1);
  mvcount = 0;
end


if(1)
  nLevel = 4;

  
  [MatDiag, SampleList, RKTree] = ConstructHMatrixDiag( N, nLevel );
  MatDiag = reshape(MatDiag, N*N,1 );
  err = norm(MatDiag - DiagExact, 1) / norm(DiagExact, 1)

  % nLevel = 2;
% 
  % [MatDiag, SampleList, RKTree] = ConstructHMatrixDiag( N, nLevel );
  % MatDiag = reshape(MatDiag, N*N,1 );
  % err = norm(MatDiag - DiagExact, 1) / norm(DiagExact, 1)
% 
  % nLevel = 3;
% 
  % [MatDiag, SampleList, RKTree] = ConstructHMatrixDiag( N, nLevel );
  % MatDiag = reshape(MatDiag, N*N,1 );
  % err = norm(MatDiag - DiagExact, 1) / norm(DiagExact, 1)
end

mvcount
